package com.xsir.dto;

import com.xsir.entity.Comment;
import com.xsir.entity.Reply;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author xsir
 * @date 2020/11/8
 */
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class CommentList implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Long id;
    
    /**
     * 文章的编号
     */
    private Long articleId;
    
    /**
     * 评论者的编号
     */
    private Long fromId;
    
    /**
     * 评论者的名字
     */
    private String fromName;
    
    /**
     * 评论者的头像
     */
    private String fromAvatar;
    
    /**
     * 点赞数
     */
    private Long hits;
    
    /**
     * 是否点过赞
     */
    private Boolean liked;
    
    /**
     * 评论的内容
     */
    private String content;
    
    /**
     * 评论发表的时间
     */
    private LocalDateTime createTime;
    
    /**
     * 状态
     */
    private Integer status;
    
    /**
     * 回复列表
     */
    private List<Reply> replies;
    
    public CommentList(Comment comment) {
        this.id = comment.getId();
        this.articleId = comment.getArticleId();
        this.fromId = comment.getFromId();
        this.fromAvatar = comment.getFromAvatar();
        this.fromName = comment.getFromName();
        this.content = comment.getContent();
        this.hits = comment.getHits();
        this.liked = comment.getLiked();
        this.createTime = comment.getCreateTime();
        this.status = comment.getStatus();
    }
}
